﻿#ifndef DRAW_H
#define DRAW_H
#include <QtQuick/QQuickPaintedItem>
#include <QColor>
#include <QObject>
#include <QPen>
#include <string>
using namespace std;
class Draw : public QQuickPaintedItem
{
    Q_OBJECT
public:
    explicit Draw(QQuickPaintedItem *parent = 0);
    void paint(QPainter *painter);
    QVector<QPointF> findData(string gasname,int mode);
    Q_INVOKABLE void setTimeRange(int range);
    Q_INVOKABLE void setStartTime(int m);
    //Q_INVOKABLE void drawgas(void);
    Q_INVOKABLE void setYear(int year);
    Q_INVOKABLE void setMonth(int Month);
    Q_INVOKABLE void setDay(int day);
    Q_INVOKABLE void setHour(int hour);
    Q_INVOKABLE void setMinute(int minute);
    Q_INVOKABLE void co(bool co_);
    Q_INVOKABLE void nox(bool nox_);
    Q_INVOKABLE void o2(bool o2_);
    Q_INVOKABLE void particulates(bool particulates_);
    Q_INVOKABLE void so2(bool so2_);
    Q_INVOKABLE void setWindowWidth(int width);
    Q_INVOKABLE void setWindowHeight(int height);
    Q_INVOKABLE void setMaxValue(int value);
    Q_INVOKABLE QString getStartTime(void);
    Q_INVOKABLE void modeSelect(int mode);
private:
    QPainter *co_painter;
    QPainter *nox_painter;
    QPainter *o2_painter;
    QPainter *particulates_painter;
    QPainter *so2_painter;
    int m_mode;
    int TimeRange;
    string StartTime;
    int syear=0;
    int smonth=0;
    int sday=0;
    int shour=0;
    int sminute=0;
    bool draw_co;
    bool draw_nox;
    bool draw_o2;
    bool draw_particulates;
    bool draw_so2;
    int window_width;
    int window_height;
    int max_value;
};

#endif // DRAW_H
